/*
 * 版权所有 (c) 2022-2099 TBIT。保留所有权利。
 */

package com.tbit.common.constant;

import cn.hutool.core.util.ArrayUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Optional;

/**
 * @author <a href="mailto:li.yao@tbit.com.cn">yao</a>
 * @version 4.2.0
 * @since 2024/9/21 21:06
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum MannedStatusEnum {

    NO_BIND(0, "未绑定"),
    BIND(1, "已绑定"),
    BINDING(2, "绑定中"),
    BIND_FAIL(3, "绑定失败"),
    UNBIND(4, "已解绑"),
    UNBINDING(5, "解绑中"),
    UNBIND_FAIL(6, "解绑失败"),

    ;

    private int status;
    private String desc;

    public static String getDesc(Integer status) {
        return Optional.ofNullable(ArrayUtil.firstMatch(v -> status.equals(v.getStatus()), values())).map(MannedStatusEnum::getDesc).orElse("");
    }

}
